import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/tabs',
      name: 'tabs',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/tabs/TabsView.vue'),
      children: [
        { name: 'home', path: '/home', component: () => import('../views/tabs/home/HomeView.vue') },
        {
          name: 'order',
          path: '/order',
          component: () => import('../views/tabs/order/OrderView.vue')
        },
        { name: 'me', path: '/me', component: () => import('../views/tabs/me/MeView.vue') }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/LoginView.vue')
    },
    {
      path: '/shop/:id',
      name: 'shop',
      component: () => import('../views/shop/ShopView.vue')
    },
    {
      path: '/goods/:id',
      name: 'goods',
      component: () => import('../views/goods/GoodsDetail.vue')
    }
  ]
})

export default router
